<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="ISO-8859-1"%>
<%@ page import = "quiz.Quiz" %>
<%@ page import = "quiz.Account" %>
<%@ page import = "java.util.ArrayList" %>
<jsp:include page="templates/header.jsp" flush="true">
	<jsp:param value = "Search | Quizzard" name = "title" />
</jsp:include>
<jsp:include page="templates/title_bar.jsp" flush = "true">
	<jsp:param value = "Search Quizzard" name = "title" />
</jsp:include>
<div id = "content">
<div class = "center">
<%
	String error = (String)request.getAttribute("error");
	if (error != null) {
		out.println("<div id = 'error'>"+error+"</div>");
	}
	
	ArrayList<Quiz> matchingQuizzes = (ArrayList<Quiz>)request.getAttribute("matchingQuizzes");
	ArrayList<Account> matchingUsers = (ArrayList<Account>)request.getAttribute("matchingUsers");
	
%>
<div class = "split_left">
<div class = "section_title bottom_border">Quiz Results</div>
<%
	if (matchingQuizzes.size() == 0) out.println("No matching quizzes");
	for (Quiz q: matchingQuizzes) {
		out.println("<div><a href = \"ShowSelectedQuiz?id="+q.getID()+"\">"+q.getName()+"</a></div>");
	}
%>
</div>
<div class = "split_right">
<div class = "section_title bottom_border">User Results</div>
<%
	if (matchingUsers.size() == 0) out.println("No matching users");
	for (Account a: matchingUsers) {
		out.println("<div><a href = \"Profile?id="+a.getID()+"\">"+a.getName()+"</a></div>");
	}
%>
</div>
<div class = "clear"></div>
</div>
</div>
<jsp:include page="templates/footer.jsp" flush="true" />